@inject NavigationManager NavigationManager

<div class="col border-top py-3">
    <img class="img-fluid rounded-3" src="@Image" alt="@Title">
    <h4 class="mt-3">@Title</h4>
    <p>$@Price per day</p>
    <div class="row gx-5 px-xxl-5 mx-xxl-5">
        <div class="btn-group">
            <button class="col-6 btn btn-primary" @onclick="RentalCar">Rent</button>
            <button class="col-6 btn btn-outline-primary" @onclick="SeeInformationCar">More Info.</button>
        </div>
    </div>
</div>

@code {
    [Parameter]
    public string Title { get; set; }
    
    [Parameter]
    public double Price { get; set; }
    
    [Parameter]
    public string Image { get; set; }
    
    [Parameter]
    public string License { get; set; }
    
    [CascadingParameter]
    private Task<AuthenticationState> AuthenticationStateTask { get; set; }
    
    private void SeeInformationCar()
    {
        NavigationManager.NavigateTo("/Vehicle/" + License);
    }

    private async Task RentalCar()
    {
        var authState = await AuthenticationStateTask;
        var user = authState.User;

        if (user.Identity.IsAuthenticated)
        {
            NavigationManager.NavigateTo("/Rent/" + License);
        }
        else
        {
            NavigationManager.NavigateTo("/SignIn");
        }
    }
}